package com.flmz.friend.controller.user;

import com.flmz.api.domain.vo.UserQuestionResultVO;
import com.flmz.common.core.controller.BaseController;
import com.flmz.common.core.domain.R;
import com.flmz.friend.domain.user.dto.UserSubmitDTO;
import com.flmz.friend.service.user.IUserQuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user/question")
public class UserQuestionController extends BaseController {

	@Autowired
	private IUserQuestionService userQuestionService;

	// 用户代码提交方法
	@PostMapping("/submit")
	public R<UserQuestionResultVO> submit(@RequestBody UserSubmitDTO submitDTO) {
		return userQuestionService.submit(submitDTO);
	}

	// rabbitmq版本
	@PostMapping("/rabbitmq/submit")
	public R<Void> rabbitSubmit(@RequestBody UserSubmitDTO submitDTO) {
		return toR(userQuestionService.rabbitmqSubmit(submitDTO));
	}

	@GetMapping("/exe/result")
	public  R<UserQuestionResultVO> exeResult(Long examId, Long questionId, String currentTime) {
		return R.ok(userQuestionService.exeResult(examId, questionId, currentTime));
	}

}
